Ext.ns('net.autodata.modelwalk.data.TrimHttpCacheProxy');
(function () {
	
	/**
	 * @class TrimCache
	 * @singelton
	 * @private
	 * TrimCache is an internal private class that is used to create a shared cache.
	 * This is way a trim list only needs to be retrieved once from the server per page load	 
	 */
	var TrimCache = {
		getInstance: function ()
		{
			var trimCache;			
			return function () {
				if (!trimCache) {
					trimCache = new Ext.util.MixedCollection(false);
				}
				
				return trimCache;
			}
		}()
	};
	
	
	/**
	 * @class TrimHttpCacheProxy
	 * TrimHttpCacheProxy is a proxy class to retrieve a list of trims from the server and store
	 * the results in a shared cache so every instance of TrimHttpCacheProxy will use the same
	 * cache.  This allows multiple trim lists to be displayed on the UI without the need to continually
	 * retrieve the same data from the server over and over again
	 * @namespace net.autodata.modelwalk.data
	 */
	var Proxy = Ext.extend(net.autodata.data.HttpCacheProxy, {
		consturctor: function ()
		{
			throw 'The net.autodata.data.HttpSingletonCacheProxy cannot be created directly';
		},
		
		getCache: function ()
		{
			var sharedProxyCache;
			return function () {
				if (!sharedProxyCache) {
					sharedProxyCache = TrimCache.getInstance();
				}
				return sharedProxyCache;
			};
		}()
	});
	
	net.autodata.modelwalk.data.TrimHttpCacheProxy = Proxy;
})();